package init

import (
	"github.com/go-redis/redis/v8"
	"log"
	"user_srv/basic/config"
)

func InitRedis() {
	config.Rdb = redis.NewClient(&redis.Options{
		Addr:     "localhost:6379",
		Password: "", // no password set
		DB:       0,  // use default DB
	})

	_, err := config.Rdb.Ping(config.Ctx).Result()
	if err != nil {
		panic("redis init failed")
	} else {
		log.Println("redis init success")
	}

}
